<%@ include file="inc/header.jspf" %>

<script type="text/javascript">
	$(document).ready(initialize);
	
	function initialize() {
		highlightTableRows();
		// setPager();
		setNavi();
	}

	function highlightTableRows() {
		$('tbody tr').hover(
			function() {
				$(this).find('td').addClass('hover');
			},
			function() {
				$(this).find('td').removeClass('hover');
			}
		);
	} // function highlightTableRows()

	function setPager() {
		$('#pager').html('${pager}');
	} // function setPager()

	function turnPage(page) {
		$('#formSearch [name="page"]').val(page);
		$('#formSearch').submit();
	}
</script>

<!-- List ------------------------------------------------------------------->
<table data-role="table" class="ui-responsive table-stroke">
	<tbody>
		<c:forEach var="note" items="${noteList}">
			<tr onclick="viewNote('${note.noteNO}');">
				<td bgcolor="white">${note.noteNO}</td>
				<td bgcolor="white">${note.category.name}</td>
				<td bgcolor="white" style="cursor: pointer;">${note.subject}</td>
				<td bgcolor="white">${fn:substring(note.date, 0, 10)}</td>
			</tr>
		</c:forEach>
	</tbody>
</table>
<!------------------------------------------------------------------- List -->

<!-- Pager ------------------------------------------------------------------>
<div id="pager" align="center" style="padding:5px;">
${pager}
</div>
<!------------------------------------------------------------------ Pager -->

<!-- Search ----------------------------------------------------------------->
<div style="float:left; width:200px;">
	<button type="button" onclick="location.href ='${pageContext.request.contextPath}/note/create';">
		<fmt:message key="create"></fmt:message>
	</button>
</div>

<form:form id="formSearch" modelAttribute="condition" method="post" action="${pageContext.request.contextPath}/note/list">
	<form:hidden path="page"/>
	<form:input path="key"/>
	<button type="submit"><fmt:message key="search"></fmt:message></button>
</form:form>
<!----------------------------------------------------------------- Search -->

<%@ include file="inc/footer.jspf" %>